package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class SecondActivity extends AppCompatActivity {
    Button button2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second_activity);
        button2 = (Button) findViewById(R.id.button_2);
        Intent intent = getIntent();
        String data = intent.getStringExtra(("extra_data"));
        Log.d("SecondActivity", data);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String data2 = "我是回传的信息";
                Intent intent1 = new Intent();
                intent1.putExtra("data_return", "我是回传的信息");
                setResult(RESULT_OK, intent1);
                finish();
            }
        });
    }
}